<script setup>
import {onMounted, ref} from "vue";

let showName = ref()

//页面加载后执行onMouted
onMounted(() =>{
  //从sessionStorage获取boss_token的showName的值
  const sessionCache = sessionStorage.getItem('BOSS_TOKEN')
  if (sessionCache){
    showName.value = JSON.parse(sessionCache).showName
  }

})


</script>

<template>
  <div style="margin-top: 10px">
    <el-row :gutter="20" >
      <el-col :span="20" :offset="0"></el-col>
      <el-col :span="4" :offset="0" class="shezhi">
        <el-dropdown>
          <el-button type="primary">
            登录用户： {{ showName }}<el-icon class="el-icon--right"><arrow-down /></el-icon>
          </el-button>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item>退出系统</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </el-col>
    </el-row>
  </div>
</template>

<style scoped>
.el-dropdown{
  float: right;
}


</style>